import request from "@/utils/request";

// 查询列表
export function listGoods(query) {
  return request({
    url: "/api/goods/list",
    method: "get",
    params: query,
  });
}

// 新增
export function addGoods(data) {
  return request({
    url: "/api/goods/add",
    method: "post",
    data: data,
  });
}

// 编辑
export function updateGoods(data) {
  return request({
    url: "/api/goods/update",
    method: "post",
    data: data,
  });
}

// 商品删除
export function deleteGoods(data) {
  return request({
    url: "/api/goods/del",
    method: "post",
    data: data,
  });
}

// 查询
export function getGoodsDetals(id) {
  return request({
    url: "/api/goods/details/" + id,
    method: "get",
  });
}

// 触发数据更新
export function goodsSumTrigger(query) {
  return request({
    url: "/api/goodsSum/trigger",
    method: "get",
    params: query,
  });
}

// 下载excel 文件
export function downExcelGoods(query) {
  return request({
    url: "/api/goods/downExcel",
    method: "get",
    responseType: "blob",
    params: query,
  });
}

// 下载excel 文件
export function downExcelFile(query) {
  return request({
    url: "/api/goods/downExcelFile",
    method: "get",
    responseType: "blob",
    params: query,
  });
}